package com.niji.littly_donkey_android.activity;

import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.niji.littly_donkey_android.R;
import com.niji.littly_donkey_android.util.StatusBarUtil;

public class ScreenTicketsActivity extends AppCompatActivity {

    private Button screen_tickets_return;

    private Button screen_tickets_comment;

    private Button screen_tickets_reserve;

    private TextView screen_tickets_details;


    @Override
    public void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.screen_tickets);
        screenTicketsReturn();
        screenTicketsComment();
        screenTicketsReserve();
        screenTicketsDetails();
        changeStatusBarTextImgColor(true);
    }
    /**
     * 界面设置状态栏字体颜色
     */
    public void changeStatusBarTextImgColor(boolean isBlack) {
        if (isBlack) {
            //设置状态栏黑色字体
            getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
        } else {
            //恢复状态栏白色字体
            getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
        }
    }
    @Override
    protected void onStart() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Window window = getWindow();
            //不加这个clearFlags好像就没效果
            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            window.getDecorView().setSystemUiVisibility(
                    View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
            //设置导航栏透明(就是虚拟键那一栏)
             
            //设置状态栏(或者叫通知栏)透明
             
            window.setStatusBarColor(Color.TRANSPARENT);
        }
        super.onStart();
    }
    private void screenTicketsDetails() {
        screen_tickets_details = findViewById(R.id.screen_tickets_details);
        screen_tickets_details = findViewById(R.id.screen_tickets_details);
        screen_tickets_details.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(ScreenTicketsActivity.this, ScreenDetailsActivity.class));
                   
            }
        });
    }

    private void screenTicketsReserve() {
        screen_tickets_reserve = findViewById(R.id.screen_tickets_reserve);
        screen_tickets_reserve = findViewById(R.id.screen_tickets_reserve);
        screen_tickets_reserve.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(ScreenTicketsActivity.this, OrderFillActivity.class));
                   
            }
        });
    }

    private void screenTicketsComment() {
        screen_tickets_comment = findViewById(R.id.screen_tickets_comment);
        screen_tickets_comment = findViewById(R.id.screen_tickets_comment);
        screen_tickets_comment.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(ScreenTicketsActivity.this, CommentActivity.class));
                   
            }
        });
    }


    /**
     * 登录界面返回
     */
    private void screenTicketsReturn() {
        screen_tickets_return = findViewById(R.id.screen_tickets_return);
        screen_tickets_return = findViewById(R.id.screen_tickets_return);
        screen_tickets_return.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                overridePendingTransition(R.anim.xpage_slide_in_left,R.anim.xpage_slide_out_right);
                finish();
            }
        });

    }
}
